package com.weixin.paleituo.bean;

import android.os.Parcel;
import android.os.Parcelable;

import java.util.List;

/**
 * 行政区区域数据bean
 *
 * @author fengzhen
 * @version v1.0, 2018/3/29
 */
public class AreaInfoBean implements Parcelable{
    /**
     * children : [{"children":[{"name":"东城区","id":110101},{"name":"西城区","id":110102},{"name":"朝阳区","id":110105},{"name":"丰台区","id":110106},{"name":"石景山区","id":110107},{"name":"海淀区","id":110108},{"name":"门头沟区","id":110109},{"name":"房山区","id":110111},{"name":"通州区","id":110112},{"name":"顺义区","id":110113},{"name":"昌平区","id":110114},{"name":"大兴区","id":110115},{"name":"怀柔区","id":110116},{"name":"平谷区","id":110117},{"name":"密云县","id":110228},{"name":"延庆县","id":110229}],"name":"北京市","id":110100}]
     * name : 北京
     * id : 110000
     */
    private String name;
    private int id;
    private List<AreaInfoBean> children;

    public AreaInfoBean(String name, int id) {
        this.name = name;
        this.id = id;
    }

    protected AreaInfoBean(Parcel in) {
        name = in.readString();
        id = in.readInt();
        children = in.createTypedArrayList(AreaInfoBean.CREATOR);
    }

    public static final Creator<AreaInfoBean> CREATOR = new Creator<AreaInfoBean>() {
        @Override
        public AreaInfoBean createFromParcel(Parcel in) {
            return new AreaInfoBean(in);
        }

        @Override
        public AreaInfoBean[] newArray(int size) {
            return new AreaInfoBean[size];
        }
    };

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public List<AreaInfoBean> getChildren() {
        return children;
    }

    public void setChildren(List<AreaInfoBean> children) {
        this.children = children;
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(name);
        dest.writeInt(id);
        dest.writeTypedList(children);
    }
}
